﻿using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;

namespace GioHangViet.Models
{
    [Table("Products")]
    public class Product
    {
        
        /// <summary>
        /// Mã sản phẩm
        /// </summary>
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductId")]
        public int Id { get; set; }

        /// <summary>
        /// Tên sản phẩm
        /// </summary>
        [Required(ErrorMessageResourceName = "ErrorProductName", ErrorMessageResourceType = typeof(Resources.Error))]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductName")]
        public string Name { get; set; }

        /// <summary>
        /// Biệt danh của sản phẩm
        /// </summary>
        [Required(ErrorMessageResourceName = "ErrorProductAlias", ErrorMessageResourceType = typeof(Resources.Error))]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductAlias")]
        public string Alias { get; set; }

        /// <summary>
        /// Số trang của sách.
        /// </summary>
        [Required(ErrorMessageResourceName = "ErrorProductPagesCount", ErrorMessageResourceType = typeof(Resources.Error))]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductPagesCount")]
        public int PagesCount { get; set; }

        /// <summary>
        /// Mã nhà xuất bản.
        /// </summary>
        [Required(ErrorMessageResourceName = "ErrorProductPublisherId", ErrorMessageResourceType = typeof(Resources.Error))]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductPublisherId")]
        public string PublisherId { get; set; }

        /// <summary>
        /// Mã ngôn ngữ.
        /// </summary>
        [Required(ErrorMessageResourceName = "ErrorProductLanguageId", ErrorMessageResourceType = typeof(Resources.Error))]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductLanguageId")]
        public string LanguageId { get; set; }

        /// <summary>
        /// Loại bìa.
        /// </summary>
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductCoverType")]
        public string CoverType { get; set; }

        /// <summary>
        /// Kích thước.
        /// </summary>
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductSize")]
        public string Size { get; set; }

        /// <summary>
        /// Trọng lượng.
        /// </summary>
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductWeight")]
        public int Weight { get; set; }

        /// <summary>
        /// Đánh giá.
        /// Update sao = (VoteCount * Star + StarCurrent do user bình chọn)/VoteCount+1
        /// </summary>
        [DefaultValue(0)]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductStar")]
        public int Star { get; set; }

        /// <summary>
        /// Số lần bình chọn. 
        /// </summary>
        [DefaultValue(0)]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductVoteCount")]
        public int VoteCount { get; set; }

        /// <summary>
        /// Giới thiệu.
        /// </summary>
        [Required(ErrorMessageResourceName = "ErrorProductDescription", ErrorMessageResourceType = typeof(Resources.Error))]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductDescription")]
        [DataType(DataType.MultilineText)]
        public string Description { get; set; }

        /// <summary>
        /// Get and Set Property Data of File column OrginizePrice in Table Products 
        /// </summary>
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductOrganizePrice")]
        public decimal OrganizePrice { get; set; }

        /// <summary>
        /// Get and Set Property Data of File column Price in Table Products 
        /// </summary>
        [Required(ErrorMessageResourceName = "ErrorProductPrice", ErrorMessageResourceType = typeof(Resources.Error))]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductPrice")]
        public decimal Price { get; set; }

        /// <summary>
        /// Get and Set Property Data of File column PublishDate in Table Products 
        /// </summary>
        [Required(ErrorMessageResourceName = "ErrorProductPublishDate", ErrorMessageResourceType = typeof(Resources.Error))]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductPublishDate")]
        public DateTime PublishDate { get; set; }

        /// <summary>
        /// Số lần xem
        /// </summary>
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductView")]
        public int Views { get; set; }

        /// <summary>
        /// Số lần mua.
        /// </summary>
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductBuy")]
        public int Buys { get; set; }

        /// <summary>
        /// Get and Set Property Data of File column Tags in Table Products 
        /// </summary>
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductTag")]
        public string Tag { get; set; }

        /// <summary>
        /// Get and Set Property Data of File column CreateBy in Table Products 
        /// </summary>
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductCreateBy")]
        public string CreateBy { get; set; }

        /// <summary>
        /// Get and Set Property Data of File column CreateDate in Table Products 
        /// </summary>
        [Required(ErrorMessageResourceName = "ErrorProductCreateDate", ErrorMessageResourceType = typeof(Resources.Error))]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductCreateDate")]
        public DateTime CreateDate { get; set; }

        /// <summary>
        /// Get and Set Property Data of File column LastestUpdate in Table Products 
        /// </summary>
        [Required(ErrorMessageResourceName = "ErrorProductLastestUpdate", ErrorMessageResourceType = typeof(Resources.Error))]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductLastestUpdate")]
        public DateTime LastestUpdate { get; set; }

        /// <summary>
        /// Get and Set Property Data of File column IsHot in Table Products 
        /// </summary>
        [DefaultValue(false)]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductIsHot")]
        public bool IsHot { get; set; }

        /// <summary>
        /// Get and Set Property Data of File column IsFilter in Table Products 
        /// </summary>
        [DefaultValue(false)]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductIsFilter")]
        public bool IsFilter { get; set; }

        /// <summary>
        /// Get and Set Property Data of File column DisplayDate in Table Products 
        /// </summary>
        [Required(ErrorMessageResourceName = "ErrorProductDisplayDate", ErrorMessageResourceType = typeof(Resources.Error))]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductDisplayDate")]
        public DateTime DisplayDate { get; set; }

        /// <summary>
        /// Get and Set Property Data of File column Status in Table Products 
        /// </summary>
        [DefaultValue(true)]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductStatus")]
        public bool Status { get; set; }

        /// <summary>
        /// Get and Set Property Data of File column Count in Table Products 
        /// </summary>
        [DefaultValue(0)]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductCount")]
        public int Count { get; set; }

        /// <summary>
        /// Get and Set Property Data of File column Available in Table Products 
        /// </summary>
        [DefaultValue(0)]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductAvailable")]
        public int Available { get; set; }

        /// <summary>
        /// Get and Set Property Data of File column LastestBuy in Table Products 
        /// </summary>
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductLastestBuy")]
        public DateTime LastestBuy { get; set; }

        /// <summary>
        /// Get and Set Property Data of File column ParentId in Table Products 
        /// </summary>
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductParentId")]
        public int ParentId { get; set; }

        /// <summary>
        /// Get and Set Property Data of File column Episode in Table Products 
        /// </summary>
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductEpisode")]
        public short Episode { get; set; }

        /// <summary>
        /// 1: sách nhiều tập, 
        /// 0: sách một tập.
        /// </summary>
        [DefaultValue(0)]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductType")]
        public byte Type { get; set; }

        /// <summary>
        /// Get and Set Property Data of File column Thumbnail in Table Products 
        /// </summary>
        [Required(ErrorMessageResourceName = "ErrorProductThumbnail", ErrorMessageResourceType = typeof(Resources.Error))]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductThumbnail")]
        public string Thumbnail { get; set; }

        /// <summary>
        /// Get and Set Property Data of File column PromotionPercent in Table Products 
        /// </summary>
        [DefaultValue(0D)]
        [Display(ResourceType = typeof(Resources.Displaies), Name = "DisplayProductPromotionPercent")]
        public double PromotionPercent { get; set; }
    }
}